How to find Extreme value of a function of two variables